import { pubRequire } from '@utils/public'
const baseUrl = '/crowds'
// 获取列表
export function getSearchList(params, callBack, errBack) {
  return pubRequire('get', `${baseUrl}`, params, callBack, errBack)
}
// 删除单个
export function deleteSingleRequest(id, callBack, errBack) {
  return pubRequire('delete', `${baseUrl}/${id}`, '', callBack, errBack)
}
// 删除多个
export function deleteMultRequest(params, callBack, errBack) {
  return pubRequire('delete', `${baseUrl}`, params, callBack, errBack)
}
// 停用人群
export function disableRequest(id, callBack, errBack) {
  return pubRequire('put', `${baseUrl}/${id}/disable`, '', callBack, errBack)
}
// 启用人群
export function enableRequest(id, callBack, errBack) {
  return pubRequire('put', `${baseUrl}/${id}/enable`, '', callBack, errBack)
}
// 获取人群规则
export function getPeopleRuleRequest(callBack, errBack) {
  return pubRequire('get', `${baseUrl}/rules`, '', callBack, errBack)
}
// 查询满足条件学员数量
export function searchStudentAPI(params, callBack, errBack) {
  return pubRequire('get', `${baseUrl}/users/count`, params, callBack, errBack)
}
// 获取人群值
export function getPeopleValueRequest(params, callBack, errBack) {
  return pubRequire(
    'get',
    `${baseUrl}/rules/${params.code}/options`,
    '',
    callBack,
    errBack
  )
}
// 获取人群详情
export function getPeopleDetailRequest(id, callBack, errBack) {
  return pubRequire('get', `${baseUrl}/${id}`, '', callBack, errBack)
}
// 创建人群
export function createPeopleRequest(params, callBack, errBack) {
  return pubRequire('post', `${baseUrl}`, params, callBack, errBack)
}
// 编辑人群
export function editPeopleAPI(id, params, callBack, errBack) {
  return pubRequire('put', `${baseUrl}/${id}`, params, callBack, errBack)
}
// 获取人群规则字典
export function getPeopleRuleDic(params, callBack, errBack) {
  return pubRequire(
    'get',
    `${baseUrl}/rules`,
    params,
    callBack,
    errBack
  )
}
// 获取金额
export function getMoneyByGroupIdsAPI(params, callBack, errBack) {
  return pubRequire('get', `${baseUrl}/sms-money`, params, callBack, errBack)
}
